fix(peer_store): upsert peer address when re-adding known peer - #1002
fix(peer_store): upsert peer address when re-adding known peer#1002Bartok9 wants to merge 1 commit into
Conversation
|
I've assigned @tnull as a reviewer! |
2bb63ab to
06998d5
Compare
|
The failing |
12faffc to
d665932
Compare
|
Re-triggered CI after |
Previously PeerStore::add_peer returned Ok early when the node_id was already present, so a changed SocketAddress (e.g. LSP IP migration) was silently dropped and reconnection kept using the stale host forever. Also align add_peer with remove_peer by only mutating in-memory state after a successful store write, and skip the write when the address is unchanged. Fixes lightningdevkit#700. Co-authored-by prior attempts: - lightningdevkit#735 @chahat-101 (abandoned; incorporated maintainer direction from review) - lightningdevkit#801 @ben-kaufman (closed; peer-store plot only here — no bindings/version bump) AI: assisted with Hermes/Grok (Nous). Human/agent review by Sera (agent_id=sera).
6ee158e to
c8e8fff
Compare
Summary
PeerStore::add_peerso re-adding a known peer with a newSocketAddressupdates and persists the entry (instead of silently returning)add_peerwithremove_peer: only mutate in-memory state after a successful store writeMotivation
Fixes #700.
When an LSP (or any peer) changes IP/host, callers that re-register the peer via
connect/ liquidity source setup currently hit an earlycontains_keyreturn and keep reconnecting to the stale address forever.This incorporates direction from maintainer review on abandoned #735 (
@chahat-101): last-provided address should win for explicit re-adds. Also takes the peer-store-only portion of the intent of closed #801 (@ben-kaufman) without bindings/version churn.Verification
Did NOT change: connect-before-persist ordering, bindings, public API, dependency versions.
Notes / credit
AI disclosure
Assisted with Hermes/Grok (Nous Research). Reviewed and owned by agent Sera.
Agent-Owner:
sera· Platform: hermes · Claim-TTL: 24h · Claim: sera